package com.mdb.open.trade.service.trade;


/*
* Copyright (C), 2017-2019 澳发科技(MDB)
* FileName: TfLoanApplyExtendInfoService.java
* Author:   you.yichao
* Date:     2019-10-11
* History:
* <author>          <time>          <version>          <desc>
* you.yichao         2019-10-11          V1.00             代码生成器初始生成代码
* -----------------------------------------------------------
* 作者姓名           修改时间           版本号            描述
*/


import com.baomidou.dynamic.datasource.annotation.DS;
import com.mdb.bc.api.data.ResultEx;
import com.mdb.bc.database.mybatisplus.SuperService;
import com.mdb.open.trade.common.MdbDataSource;
import com.mdb.open.trade.domain.bo.trade.LoanApplyExtendInfoBo;
import com.mdb.open.trade.domain.po.trade.LoanApplyExtendInfo;
import com.mdb.open.trade.mapper.trade.TfLoanApplyExtendInfoMapper;
import org.springframework.stereotype.Service;

/**
 * 类描述：
 *  贸易融资额外信息表 服务类
 *
 * @author you.yichao
 * @date 2019-10-11
 */
@Service
@DS(MdbDataSource.TRADE)
public class TfLoanApplyExtendInfoService extends SuperService<TfLoanApplyExtendInfoMapper, LoanApplyExtendInfo> {

    public ResultEx saveExtendInfo(LoanApplyExtendInfoBo bo) {

        LoanApplyExtendInfo info = new LoanApplyExtendInfo();
        info.setApplyOrderNo(bo.getApplyOrderNo());
        info.setBusinessNo(bo.getBusinessNo());
        info.setCustomerCode(bo.getCustomerCode());
        info.setMcustomerCode(bo.getMcustomerCode());
        info.setCustomerName(bo.getCustomerName());
        info.setMerchantNo(bo.getMerchantNo());
        info.setMerchantName(bo.getMerchantName());
        info.setDepositAmount(bo.getDepositAmount());
        info.setDepositCcy(bo.getDepositCcy());
        info.setDepositPercent(bo.getDepositPercent());
        info.setInsuranceAmount(bo.getInsuranceAmount());
        info.setInsuranceCcy(bo.getInsuranceCcy());
        info.setInsurancePercent(bo.getInsurancePercent());
        info.setStatus(bo.getStatus());
        info.setSourceType(bo.getSourceType());

        int count = this.baseMapper.insert(info);
        if (count != 1) {
            return ResultEx.fail();
        }
        return ResultEx.ok();
    }

}
